package con.zzjson.config;

/**
 * <p>****************************************************************************</p>
 * <p><b>Copyright © 2010-2019 shuncom team All Rights Reserved<b></p>
 * <ul style="margin:15px;">
 * <li>Description : con.zzjson.config</li>
 * <li>Version     : 1.0.0</li>
 * <li>Creation    : 2019年09月21日</li>
 * <li>@author     : zzy0_0</li>
 * </ul>
 * <p>****************************************************************************</p>
 */

import con.zzjson.annotation.Timeout;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.Method;

/**
 * timeout 注解实现拦截器
 *
 * @see con.zzjson.annotation.Timeout
 */
public class TimeoutAnnotationHandlerInterceptor implements HandlerInterceptor {
	@Override
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
		if (handler instanceof HandlerMethod) {
			HandlerMethod handlerMethod = (HandlerMethod) handler;
			Method method = handlerMethod.getMethod();
			Timeout annotation = method.getAnnotation(Timeout.class);
			if (annotation != null) {

			}

		}
		return true;
	}
}